// pages/refund/refund.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    _num: 0,
    ischose: true,
    need:"一",
    notify: [
      // {
        // img: "../../img/a_55_07.png",
        // name: "退款到微信",
        // date: "2018-07-10",
        // money: "+100.00"
      // }
    ],
    order: [
      // {
      //   src: "../../img/a_13_19.png",
      //   name: "西安车工坊营销部",
      //   status: "订单完成",
      //   goods_img: "../../img/a_60_03.png",
      //   info_title: "飞利浦（PHILIPS）迷你车载充电飞利浦（PHILIPS）迷你车载充电",
      //   price: "69.0",
      //   quantity: 1,
      //   total: "69.0"
      // }
    ]
  },
  focus_click: function (e) {
    let that = this
    var ischose = that.data.ischose
    that.setData({
      _num: e.currentTarget.dataset.num,
      ischose: !ischose
    })
    var num = e.currentTarget.dataset.num;
    if (num == 1){
      var uid = wx.getStorageSync('uid');
      wx.request({
        url: app.url + '/Reback/reback_lists_all',
        data: { uid: uid },
        method: 'post',
        success: function (res) {
          console.log(res);
          that.setData({
            notify: res.data.data
          })
        },
        error: function () { }
      })
    }else{
      wx.request({
        url: app.url + '/Reback/reading_reback_all',
        data: { data:  0},
        method: 'post',
        success: function (res) {
          that.setData({
            order: res.data.data
          })
        },
        error: function () { }
      })
    }
  },

  goshop: function () {
    wx.navigateTo({
      url: '../mall/mall',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    var uid = wx.getStorageSync('uid');
    wx.request({
      url: app.url + '/Reback/reback_lists',
      data: { uid: uid },
      method: 'post',
      success: function (res) {
        console.log(res);
        that.setData({
          notify: res.data.data
        })
      },
      error: function () { }
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})